package com.cml.common.dto.entity;

import java.nio.ByteBuffer;

/**
 * 姓名：陈茂林
 * 时间：2023/10/17 16:56
 * 描述：
 */
public abstract class Message {
    public   static final Integer MESSAGE_TYPE_LENGTH = 4;

    public static  final Integer INTGER_TYPE_LENGTH=4;
    private Integer messageType;

    private Integer messageLength;

    private ByteBuffer messageBuffer;


    public ByteBuffer getMessageBuffer() {
        return messageBuffer;
    }

    public void setMessageBuffer(ByteBuffer messageBuffer) {
        this.messageBuffer = messageBuffer;
    }


    public  Integer getMessageLength() {
        return Message.MESSAGE_TYPE_LENGTH + doGetMessageLength();
    }

    public abstract Integer doGetMessageLength();

    public Message()
    {
        this.messageType = doGetMessageType();
    }
    public abstract  Integer doGetMessageType();

    public Integer getMessageType() {
        return messageType;
    }

    public void setMessageType(Integer messageType) {
        this.messageType = messageType;
    }
}
